﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ThaireInvestmentWeb.Util;
using ThaireInvestmentWeb.WcfSerivce;

namespace ThaireInvestmentWeb.Models
{
    public class EquityTransactionAdapter
    {
        private readonly EquityHeader _header;
        private readonly EquityTransaction _data;
        public EquityTransactionAdapter(EquityTransaction data, EquityHeader header)
        {
            _data = data;
            _header = header;
        }

        #region header adapter
        public virtual string FullNameEN
        {
            get { return _header.FullNameEN; }
        }
        //public virtual string CounterParty
        //{
        //    get { return _header.FundName; }
        //}
        //public virtual double TimeToMaturityDate
        //{
        //    get { return Calculator.CalTime2Mature(_header.MaturityDate.GetValueOrDefault()); }
        //}
        #endregion



        public string Link
        {
            get
            {
                string method = "EditPurchaseTransaction";
                if (TransactionType.ToUpper().Trim() == "SALE")
                    method = "EditSaleTransaction";
                if (TransactionType.ToUpper().Trim() == "GUARANTEE")
                    method = "EditGuaranteeTransaction";
                return string.Format("{0}?transactionId={1}", method, _data.EquityTransactionID);
            }
        }



        public int ID
        {
            get { return _data.EquityTransactionID; }
        }
        // UNIT_TRUST_TRANSACTION_HEADER_ID
        //public virtual int EquityTransactionHeaderID
        //{
        //    get { return _data.EquityTransactionHeaderID; }
        //}
        // TRANSACTION_TYPE
        public virtual String TransactionType
        {
            get { return _data.TransactionType; }
        }
        // REF_NO
        public virtual string RefNO
        {
            get { return _data.RefNO; }
        }
        // TYPEOFPAYMENT_NAME
        //public virtual String TypeofpaymentName
        //{
        //    get { return _data.TypeofpaymentName; }
        //}
        // TYPEOFPAYMENT_ID
        public virtual int? TypeofpaymentID
        {
            get { return _data.TypeofpaymentID; }
        }
        // TRADE_DATE
        public virtual DateTime? TradeDate
        {
            get { return _data.TradeDate; }
        }
        // SETTLEMENT_DATE
        public virtual DateTime? SettlementDate
        {
            get { return _data.SettlementDate; }
        }
        // UNIT
        public virtual int? Unit
        {
            get { return _data.Unit; }
        }
        // PRICE_UNIT
        public virtual decimal? PriceUnit
        {
            get { return _data.PriceUnit; }
        }
        // GROSS_AMOUNT
        public virtual decimal? GrossAmount
        {
            get { return _data.GrossAmount; }
        }
        // COM_RATE
        public virtual decimal? ComRate
        {
            get { return _data.ComRate; }
        }
        // COM_AMOUNT
        public virtual decimal? ComAmount
        {
            get { return _data.ComAmount; }
        }
        // VAT_RATE
        public virtual decimal? VatRate
        {
            get { return _data.VatRate; }
        }
        // VAT_AMOUNT
        public virtual decimal? VatAmount
        {
            get { return _data.VatAmount; }
        }
        // PURCHASE_VALUE_NET
        public virtual decimal? PurchaseValueNet
        {
            get { return _data.PurchaseValueNet; }
        }
        // WH_TAX_RATE
        public virtual decimal? WHTaxRate
        {
            get { return _data.WHTaxRate; }
        }
        // WH_TAX_AMOUNT
        public virtual decimal? WHTaxAmount
        {
            get { return _data.WHTaxAmount; }
        }
        // NET_SETTLE
        public virtual decimal? NetSettle
        {
            get { return _data.NetSettle; }
        }
        // PHYSICAL
        //public virtual String Physical
        //{
        //    get { return _data.Physical; }
        //}
        //// KEEP_AT
        //public virtual String KeepAT
        //{
        //    get { return _data.KeepAT; }
        //}
        //// OBLIGATION
        //public virtual String Obligation
        //{
        //    get { return _data.Obligation; }
        //}
        //// OBLIGATION_NO
        //public virtual String ObligationNO
        //{
        //    get { return _data.ObligationNO; }
        //}
        // GUARANTEE_START_DATE
        public virtual DateTime? GuaranteeStartDate
        {
            get { return _data.GuaranteeStartDate; }
        }
        // GUARANTEE_END_DATE
        public virtual DateTime? GuaranteeEndDate
        {
            get { return _data.GuaranteeEndDate; }
        }
        // CREATE_DATE
        public virtual DateTime? CreateDate
        {
            get { return _data.CreateDate; }
        }
        // CREATE_BY
        public virtual String CreateBY
        {
            get { return _data.CreateBY; }
        }
        // MODIFY_DATE
        public virtual DateTime? ModifyDate
        {
            get { return _data.ModifyDate; }
        }
        // MODIFY_BY
        public virtual String ModifyBY
        {
            get { return _data.ModifyBY; }
        }
    }
}